import Vue from 'vue'
import VueRouter from 'vue-router'
import router_modular from '@/router/router_modular/index.js'
Vue.use(VueRouter)

const routes = [
  ...router_modular
]

const router = new VueRouter({
  mode: 'history', // 去掉url中的#
  // mode: 'hash', // 去掉url中的#
  base:'market',
  routes
})
//全局路由守卫
router.beforeEach((to,from,next)=>{
  if(to.meta && to.meta.title){//判断是否有标题
    document.title = to.meta.title
  }
  next()
})
router.afterEach((to,from)=>{
})
export default router
